package o;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import java.util.Timer;

public abstract class evv {
    private SensorEventListener ʻ;
    private Timer ʽ;
    private Sensor ˊ;
    private int ˋ = -1;
    private int ˎ;
    private boolean ˏ = false;
    private SensorManager ॱ;
    private boolean ॱॱ = false;

    public abstract void ˎ(int i);

    public abstract boolean ˎ();

    public evv(Context context, int i) {
        this.ॱ = (SensorManager) context.getSystemService("sensor");
        this.ˎ = i;
        this.ˊ = this.ॱ.getDefaultSensor(1);
        if (this.ˊ != null) {
            this.ʻ = new a(this);
        }
    }

    public void ˏ() {
        if (this.ˊ == null) {
            Logger.ˋ("OrientationEvent", "Cannot detect sensors. Not enabled");
        } else if (!this.ˏ) {
            Logger.ˏ("OrientationEvent", "OrientationEventListener enabled");
            this.ॱ.registerListener(this.ʻ, this.ˊ, this.ˎ);
            this.ʽ = new Timer();
            this.ʽ.scheduleAtFixedRate(new 1(this), 0, 500);
            this.ˏ = true;
        }
    }

    public void ˋ() {
        if (this.ʽ != null) {
            this.ʽ.cancel();
        }
        if (this.ˊ == null) {
            Logger.ˋ("OrientationEvent", "Cannot detect sensors. Invalid disable");
        } else if (this.ˏ) {
            this.ॱ.unregisterListener(this.ʻ);
            this.ˏ = false;
        }
    }
}
